package org.dandsoft.blackbox.snn;

import org.dandsoft.blackbox.Time;
import org.dandsoft.blackbox.logger.Logger;
import org.dandsoft.blackbox.logger.Message;
import org.dandsoft.blackbox.logger.MessageLevel;

/**
 * User: dvilyuzhanin
 * Date: 21.01.2009 12:34:21
 */
public class NeuronFieldMonitor {

    private Logger logger;

    public Logger getLogger() {
        return logger;
    }

    public void setLogger(Logger logger) {
        this.logger = logger;
    }

    public void startWork(Time time) {
        if (logger != null) {
            logger.log(Message.createBuilder(MessageLevel.INFO, "snn.field.work.start", "")
                    .addParameter("time", time).build());
        }
    }

    public void finishWork(Time time) {
        if (logger != null) {
            logger.log(Message.createBuilder(MessageLevel.INFO, "snn.field.work.finish", "")
                    .addParameter("time", time).build());
        }
    }

    public void startNewTimeUnit(Time time) {
        if (logger != null) {
            logger.log(Message.createBuilder(MessageLevel.INFO, "snn.field.time.start", "")
                    .addParameter("time", time).build());
        }
    }

    public void startNewTimeUnitError(Time time, String message) {
        if (logger != null) {
            logger.log(Message.createBuilder(MessageLevel.ERROR, "snn.field.time.start", message)
                    .addParameter("time", time).build());
        }
    }

    public void finishTimeUnit(Time time) {
        if (logger != null) {
            logger.log(Message.createBuilder(MessageLevel.INFO, "snn.field.time.finish", "")
                    .addParameter("time", time).build());
        }
    }

    public void activateSynapses(Time time) {
        if (logger != null) {
            logger.log(Message.createBuilder(MessageLevel.INFO, "snn.field.synapses.activate", "")
                    .addParameter("time", time).build());
        }
    }

    public void activateNeurons(Time time) {
        if (logger != null) {
            logger.log(Message.createBuilder(MessageLevel.INFO, "snn.field.neurons.activate", "")
                    .addParameter("time", time).build());
        }
    }
}
